README File for Plugins folder of SPICE

This folder should contain plug-ins for the SPICE framework.  The plug-in framework consists of two parts: a SPICE adapter device and a plug-in device.  These two parts should not share any data space other than messages and parameters passed through the SPICE device connector pane.  A few SPICE adapters are built into the SPICE source code.  

SPICE adapter devices are configured like other devices.  Adapters require two configuration keys: PlugIn_Device_Library and PlugIn_Device_Class.  These keys are used to identify a specific run-time plugIn.  Like other SPICE device configurations, all parameters for the plug-in device are included in the adapters configuration section.  In order to decouple the adapter from the plug-in code, all key-value pairs are loaded into a configuration table as part of the plug-in interface.  Plug-ins should use "Get Attribute" and "Set Attribute" function calls to retrieve specific key-value pairs.  Configuration sections for an example Virtual Motor adapter are as follows:

file = controllers.config

[plugin_virtual_motor_controller]
enable=true
vi=PlugInDevices.lvlib:adapter_device_controller.vi
alias=virtual_PI_Controller
class=controller
type=motor
description="Test virtual motor controller."
PlugIn_Device_Library=VirtualMotor.lvlibp
PlugIn_Device_Class=VirtualMotor_Controller.lvclass
virtual_motor_device_vi=virtual_motor_device.vi

File = motors.config

[plugin_virtual_motor_1]
enable=true
vi=PlugInDevices.lvlib:adapter_device_motor.vi
alias=vm1
class=motor
type=monochromator
description="Test virtual motor channel."
PlugIn_Device_Library=VirtualMotor.lvlibp
PlugIn_Device_Class=VirtualMotor_Channel.lvclass
motor_units="deg"
show_hide=TRUE
user_lower_limit=-10
user_upper_limit=85
motor_units=deg
motor_hold_position=0.00
motor_speed=slow
motor_jog_stepsize=0.01
motor_tolerance=0.05
motor_zero=0.31415
motor_hold_status=FALSE
motor_show_hide=TRUE
controller=plugin_virtual_motor_controller
axis=1
fast_speed=2
slow_speed=0.5
reference_position=""
program_names=rand1
program_vi_name=unknown
last_program_run=none
current_position=12.331034045
program_status=0

The plug-in device is distributed as a packed library.  The selection of a plug-in project library is considered, but not fully tested with the prototype.  A plug-in is structured in a packed library (*.lvlibp) file format with the required naming convention:

AppDir \ PlugIns \ <piDevice> \ <piDevice>.lvlibp : <piClass>.lvclass

Where the packed library name, piDevice is both:
1. A sub-folder of the required Plug-ins folder (which is in the same directory as spice_code.
2. The root name of the packed library, i.e. piDevice.lvlibp

Because some SPICE devices use multiple classes of objects, such a motor controller, the class name, piClass is also required.

The SPICE adapter is a SPICE-specific device VI that forwards all SPICE generated messages to specific implementations of plugIn Devices.  That interface is defined by the packed library:

 "AppDir \ Interface \ genericDevice \ genericDevice.lvlibp : genericDevice.lvclass"

All plug-in Devices must be derived from this interface device.  Plug-in Devices follow a similiar file structure and are located as:

"AppDir \ PlugIns \ plugInDevice \PlugInDevice.lvlibp : plugInClass.lvclass.


Additional Notes:
If a pre-allocated instance MUST maintain state data, as in the device (SPICE-side) adapters, then it must use an execution model of "Pre-allocated Clone Reentrancy">
